<?php

namespace backend\models;

use Yii;

/**
 * This is the model class for table "tme_orderdetailsinfo".
 *
 * @property integer $ID
 * @property string $BillCode
 * @property integer $TMe_ID
 * @property string $MerchandiseID
 * @property integer $UnitID
 * @property integer $Num
 * @property double $Price
 *
 * @property TmeOrderinfo $billCode
 * @property TmeUnitinfo $unit
 * @property TmeMerchandiseinfo $tMe
 */
class TmeOrderdetailsinfo extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'tme_orderdetailsinfo';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['TMe_ID', 'UnitID', 'Num'], 'integer'],
            [['Price'], 'number'],
            [['BillCode'], 'string', 'max' => 30],
            [['MerchandiseID'], 'string', 'max' => 20]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'ID' => 'ID',
            'BillCode' => 'Bill Code',
            'TMe_ID' => 'Tme  ID',
            'MerchandiseID' => 'Merchandise ID',
            'UnitID' => 'Unit ID',
            'Num' => 'Num',
            'Price' => 'Price',
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getBillCode()
    {
        return $this->hasOne(TmeOrderinfo::className(), ['BillCode' => 'BillCode']);
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getUnit()
    {
        return $this->hasOne(TmeUnitinfo::className(), ['UnitID' => 'UnitID']);
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getTMe()
    {
        return $this->hasOne(TmeMerchandiseinfo::className(), ['ID' => 'TMe_ID', 'MerchandiseID' => 'MerchandiseID']);
    }
}
